; TASACS.nsi
;
; This script remember the directory, 
; has uninstall support and (optionally) installs start menu shortcuts.
;
; It will install TASACS.nsi into a directory that the user selects,

;--------------------------------

; The name of the installer
Name "TASACS setup"

; The file to write
;OutFile "R:\433-Pelagisk\tasacs\release\Setup TASACS (${__DATE__}).exe"
OutFile "c:\projects\tasacs\release\Setup TASACS (${__DATE__}).exe"


; The default installation directory
InstallDir $PROGRAMFILES\TASACS

; Registry key to check for directory (so if you install again, it will 
; overwrite the old one automatically)
InstallDirRegKey HKCU "Software\TASACS" "Install_Dir"

;--------------------------------

; Pages

Page components
Page directory
Page instfiles

UninstPage uninstConfirm
UninstPage instfiles

;--------------------------------

; TASACS 
Section "TASACS"
  ; Set output path to the installation directory.
  SetOutPath $INSTDIR
  ; Put file there
  File "c:\program files\tasacs\TASACS.exe"
  File "c:\program files\tasacs\TasacsTrend.exe"
  File "c:\program files\tasacs\TASACS.dll"

  WriteRegStr HKCU SOFTWARE\Tasacs "ProjectPath" "$INSTDIR\tasacs\data\examples\nssh"

  ; clx dependencies
  SetOutPath $SYSDIR
  File "c:\windows\system32\cc3260mt.dll"
  File "c:\windows\system32\qtintf70.dll"
  File "c:\windows\system32\xerceslib.dll"
  File "c:\windows\system32\xercesxmldom.dll"

  CreateDirectory "$SMPROGRAMS\TASACS"
  CreateShortCut "$SMPROGRAMS\TASACS\TASACS.lnk" "$INSTDIR\TASACS.exe" "" "$INSTDIR\TASACS.exe" 0
  CreateShortCut "$STARTMENU\TASACS.lnk" "$INSTDIR\TASACS.exe" "" "$INSTDIR\TASACS.exe" 0
  CreateShortCut "$QUICKLAUNCH\TASACS.lnk" "$INSTDIR\TASACS.exe" "" "$INSTDIR\TASACS.exe" 0
  CreateShortCut "$DESKTOP\TASACS.lnk" "$INSTDIR\TASACS.exe" "" "$INSTDIR\TASACS.exe" 0
SectionEnd


; Example data
Section "TASACS data"
  SetOutPath "$INSTDIR\Data"
  File /r "C:\Projects\tasacs\data\examples\*.txt"
SectionEnd


; Fortran source and documentation
Section "Source and Documentation"
  ; Set output path to the installation directory.
  SetOutPath "$INSTDIR\Source"
  ; Put file there
  File "c:\projects\tasacs\*.f90"
  SetOutPath "$INSTDIR\Documentation"
  ; Put file there
  File "c:\projects\tasacs\documentation\tasacs-manual.doc"
SectionEnd

;--------------------------------

; Uninstaller

Section "Uninstall"

  ; Remove registry keys
  DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\TASACS"
  DeleteRegKey HKCU SOFTWARE\TASACS


  ; Remove files and uninstaller
  Delete "$INSTDIR\*.*"

  ; Delete $INSTDIR\uninstall.exe

  ; Remove shortcuts, if any
  Delete "$SMPROGRAMS\TASACS\*.*"

  ; Remove directories used
  RMDir "$SMPROGRAMS\TASACS"
  RMDir "$INSTDIR"

SectionEnd
